package com.starlink.model.util;

import com.starlink.model.dtomapper.ShoppingCartDetailDtoMapper;
import com.starlink.model.domain.ShoppingCartDetailDO;
import com.starlink.model.vo.ShoppingCartDetailVO;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhanghong
 */
public class ShoppingCartDetailConvert {

    public static List<ShoppingCartDetailVO> buildShoppingCartDetailVoList(List<ShoppingCartDetailDO> shoppingCartDetailDOList) {
        if (CollectionUtils.isEmpty(shoppingCartDetailDOList)) {
            return Lists.newArrayList();
        }
        List<ShoppingCartDetailVO> shoppingCartDetailVOList = new ArrayList<>();
        for (ShoppingCartDetailDO shoppingCartDetailDO : shoppingCartDetailDOList) {
            shoppingCartDetailVOList.add(ShoppingCartDetailDtoMapper.INSTANCE.do2VO(shoppingCartDetailDO));
        }

        return shoppingCartDetailVOList;
    }
}
